/**   
 * @Title: WeaterInfoParser.java
 * @Package com.willter.weather.utils
 * @Description: TODO(描述文件)
 * 		<p>
 * @author willter
 * @date 2012-9-14
 */
package com.willter.weather.utils;

/**
 * @ClassName: WeaterInfoParser
 * @Description: 从中央气象台获取天气预报信息的工具类
 *               <p>
 * @author willter
 * @date 2012-9-14
 */
public class WeaterInfoParser {

	/**
	 * @Title: parseCity
	 * @Description: 解析content，得到一个一维为城市编号，二维为城市名的二维数组
	 * 		<p>
	 * @author willter
	 * @date 2012-9-14
	 * 		<p>
	 * @param content 解析的字符串
	 * @return 封装城市编码与名称的二维数组
	 */
	public static String[][] parseCity(String content) {
		if (null != content && content.trim().length() > 0) {
			String[] cityCodeArray = content.split(",");
			int length = cityCodeArray.length;
			String[][] citys = new String[length][];
			String[] cityArray = null;
			for (int i = 0; i < length; i++) {
				cityArray = cityCodeArray[i].split("|");
				for (int j = 0; j < cityArray.length; j++) {
					citys[i][0] = cityArray[0];
					citys[i][1] = cityArray[1];
				}
			}
			return citys;
		}

		return null;
	}
}
